#include<linux/module.h>
#include<linux/kernel.h>
#include<linux/sched/task.h>
#include<linux/sched.h>

int init_module(void){
    struct task_struct *ts;
    struct mm_struct *ms;
    struct vm_area_struct *mmap;
    unsigned long vm_start;
    unsigned long size;

    printk(KERN_INFO "task_7\n");
    ts = current;
    ms = ts->active_mm;
    down_read(&(ms->mmap_sem));
    for(mmap = ms->mmap; mmap; mmap = mmap->vm_next){
        vm_start = mmap -> vm_start;
        size = mmap -> vm_end - mmap -> vm_start;
        printk(KERN_INFO "VM AREA START: %lx , LENGTH: %lx\n", vm_start, size);
    }
    up_read(&(ms->mmap_sem));
    return 0;
}

void cleanup_module(void){
    printk("task_7 end\n");
}